package org.br.erp.base.controller;

import com.alibaba.fastjson.JSONObject;
import org.br.erp.base.entity.onlcgformfield;
import org.br.erp.base.service.IOnlcgformHeadService;
import org.br.erp.base.utils.ERPUtils;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/base/erponlineform")
public class OnlineFormController {

    @Autowired
    private IOnlcgformHeadService onlcgformHeadService;


    @GetMapping("/getcgformfieldbyheadid")
    private Result<List<onlcgformfield>> getOnlCgFormFieldOfHeadByHeadId(HttpServletRequest httpServletRequest){
        Map<String, String[]> parameterMap = httpServletRequest.getParameterMap();
        if(ERPUtils.ifHtppReqParamContainKey(parameterMap,"headid")){
            List<onlcgformfield> headid = onlcgformHeadService.getFieldOfHeadByHeadId(ERPUtils.getHttpReqParam(parameterMap, "headid"));
            return Result.ok(headid);
        }else {
            return Result.error("不存在");
        }
    }
}
